<template>
  <div class="card-container">
    <!-- 最佳推荐 -->
    <div class="best-recommend">
      <span>最佳推荐</span>
    </div>
    <div class="card">
      <div class="bourn">
        <span>北京</span>
        <div class="address">
          <img src="../../static/img/air2.png" alt="" />
          <span>南航 CZ3210</span>
        </div>
        <span>上海</span>
      </div>
      <div class="card-content">
        <span>2024年1月25日 22:00 ~ 00:50</span>
      </div>
      <div class="price-desc">
        <div class="left">
          <div class="price">
            <span class="dot">￥</span>
            <span>800</span>
          </div>
          <div class="desc">
            <div class="desc-content">
              <div class="left">
                <span>AI帮您省了</span>
              </div>
              <div class="right">
                <span>100元</span>
              </div>
            </div>
          </div>
        </div>
        <span class="num">2</span>
      </div>
      <div class="dotted-line"></div>
      <div class="bottom">
        <div class="user">
          <div class="info" @click="addUser">
            <img class="userimg" src="../../static/img/add.png" alt="" />
            <span>添加人</span>
          </div>
          <block v-for="item in passenger">
            <div class="info">
              <img class="userimg" src="../../static/img/user.png" alt="" />
              <span>张华</span>
            </div>
          </block>
        </div>

        <img class="airplane" src="../../static/img/airbg.png" alt="" />
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
import { ref, defineEmits } from "vue";
let passenger = ref([]);

const emit = defineEmits(["addUser"]);

function addUser() {
  emit("addUser");
}
</script>
<style scoped lang="scss">
.card-container {
  // width: 27vw;
  background: #ffffff;
  box-shadow: 0px 3px 8px 0px rgba(171, 181, 191, 0.2);
  border-radius: 11px;
  margin-top: 15px;
  position: relative;
  // border: 2rpx solid #005ff9;

  .best-recommend {
    width: 143rpx;
    height: 56rpx;
    background: #dbf5e0;
    border-radius: 0px 12px 0px 8px;
    position: absolute;
    right: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    span {
      font-family: PingFangSC, PingFang SC;
      font-weight: bold;
      font-size: 14px;
      color: #35c74f;
      line-height: 14px;
      text-align: center;
      font-style: normal;
    }
  }

  .card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    // width: 70%;
    padding: 20px;
    .bourn {
      display: flex;
      align-items: center;

      .address {
        // width: 206rpx;
        // height: 34rpx;
        display: flex;
        align-items: center;
        img {
          width: 38rpx;
          height: 34rpx;
          margin: 0 4px;
        }
        span {
          font-family: PingFangSC, PingFang SC;
          font-weight: 400;
          font-size: 28rpx;
          color: #6f6f6f;
          line-height: 28rpx;
          text-align: center;
          font-style: normal;
        }
      }

      & > :nth-child(1),
      & > :nth-child(3) {
        width: 80rpx;
        height: 40rpx;
        font-family: PingFangSC, PingFang SC;
        font-weight: 600;
        font-size: 40rpx;
        color: #000000;
        line-height: 40rpx;
        text-align: left;
        font-style: normal;
      }
    }

    .card-content {
      display: flex;
      align-items: center;
      margin-top: 15px;
      span {
        font-family: PingFangSC, PingFang SC;
        font-weight: 400;
        font-size: 14px;
        color: #6f6f6f;
        line-height: 14px;
        text-align: left;
        font-style: normal;
      }
    }

    .price-desc {
      display: flex;
      align-items: center;
      margin-top: 18px;
      width: 612rpx;
      justify-content: space-between;

      .num {
        width: 64rpx;
        height: 32rpx;
        font-family: PingFangSC, PingFang SC;
        font-weight: 600;
        font-size: 36rpx;
        color: #000000;
        line-height: 32rpx;
        text-align: right;
        font-style: normal;

        &::before {
          content: "x";
          font-family: PingFangSC, PingFang SC;
          font-weight: 600;
          font-size: 36rpx;
          color: #000000;
          line-height: 32rpx;
          text-align: right;
          font-style: normal;
          margin-right: 5px;
        }
      }

      .left {
        display: flex;
        align-items: center;

        .desc {
          width: 202rpx;
          height: 42rpx;
          border-radius: 3px;
          border: 1px solid #f23232;
          margin-left: 10px;
          .desc-content {
            display: flex;
            align-items: center;

            .right {
              width: 86rpx;
              height: 42rpx;
              background: #f23232;
              border-radius: 3px;
              display: flex;
              align-items: center;
              justify-content: center;
              margin-left: 1px;

              span {
                font-family: PingFangSC, PingFang SC;
                font-weight: 400;
                font-size: 24rpx;
                color: #ffffff;
                line-height: 11px;
                text-align: left;
                font-style: normal;
                // width: 55px;
              }
            }
            .left {
              height: 21px;
              background: rgba(242, 50, 50, 0.08);
              border-radius: 3px;
              //   border: 1px solid #f23232;
              display: flex;
              align-items: center;
              justify-content: center;

              span {
                font-family: PingFangSC, PingFang SC;
                font-weight: 400;
                font-size: 11px;
                color: #f23232;
                line-height: 11px;
                text-align: left;
                font-style: normal;
                width: 57px;
                margin-left: 3px;
              }
            }
          }
        }

        .price {
          display: flex;
          .dot {
            font-family: Gotham, Gotham;
            font-weight: bold;
            font-size: 36rpx;
            color: #f23232;
            line-height: 90rpx;
            text-align: left;
            font-style: normal;
          }
          span {
            font-family: Gotham, Gotham;
            font-weight: bold;
            font-size: 68rpx;
            color: #f23232;
            line-height: 80rpx;
            text-align: left;
            font-style: normal;
          }
        }
      }
    }

    .dotted-line {
      width: 610rpx;
      border: 1px dashed #cfcfcf;
      margin-top: 15px;
    }
    .bottom {
      display: flex;
      .user {
        position: absolute;
        display: flex;
        align-items: center;
        left: 12px;
        bottom: 8%;

        .info {
          display: flex;
          flex-direction: column;
          align-items: center;
          justify-content: flex-start;
          width: 40px;
          margin-left: 10px;
          .userimg {
            width: 80rpx;
            height: 80rpx;
          }
          span {
            width: 84rpx;
            height: 28rpx;
            font-family: PingFangSC, PingFang SC;
            font-weight: 400;
            font-size: 28rpx;
            color: #000000;
            line-height: 28rpx;
            text-align: center;
            font-style: normal;
            margin-top: 8rpx;
          }
        }
      }
      .airplane {
        // width: 80%;
        width: 606rpx;
        height: 118rpx;
        margin-left: 30rpx;
        margin-top: 1px;
        left: 10px;
      }
    }
  }
}
</style>
